// 提示框

export default {
    namespaced: true,
    state: {
        // 是否显示提示框
        isToastShow: false,
        // 提示内容
        toastMsg: "手机号",
        // 提示类型
        toastType: "类似"//success danger warning

    },
    mutations: {
        // 修改isToastShow的方法
        changisToastShow(state, payload) {
            // payload 是一个对象{isshow:true,msg:"手机号不能为空",type:"danger" }
            state.isToastShow = payload.isshow
            if (payload.isshow) {
                state.toastMsg = payload.msg
                state.toastType = payload.type

            }
        }
    },
    actions: {
        asyncChangisToastShow(state, payload) {
            // 调用mutations中的方法
            state.commit("changisToastShow", payload)
            setTimeout(() => {
                state.commit("changisToastShow", {
                    isshow: false
                })
            }, 1000)
        }
    }

}